package com.edu.service.impl;

import com.edu.dao.TeacherDao;
import com.edu.entity.Teacher;
import com.edu.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class TeacherServiceImpl implements TeacherService {

    @Autowired
    private TeacherDao teacherDao;

    @Override
    public Teacher save(Teacher teacher) {
        teacherDao.save(teacher);
        return teacher;
    }

    @Override
    public Teacher findById(Integer teacherId) {
        return teacherDao.findById(teacherId);
    }

    @Override
    public Teacher findByTeacherNo(String teacherNo) {
        return teacherDao.findByTeacherNo(teacherNo);
    }

    @Override
    public List<Teacher> findAll() {
        return teacherDao.findAll();
    }

    @Override
    public Teacher update(Teacher teacher) {
        teacherDao.update(teacher);
        return teacher;
    }

    @Override
    public void delete(Integer teacherId) {
        teacherDao.delete(teacherId);
    }

    @Override
    public List<Teacher> search(String keyword) {
        return teacherDao.search(keyword);
    }
}